use std::collections::HashMap;
struct Solution {}

impl Solution {
    pub fn longest_common_prefix(strs: Vec<String>) -> String {
        let s1 = strs.get(0).unwrap();
        let mut start = "";
        for idx in 1..s1.len() + 1 {
            start = &s1[..idx];
            for str_idx in 1..strs.len() {
                if !strs[str_idx].starts_with(start) {
                    start = &start[..idx-1];
                    return start.to_string();
                }
            }
        }
        start.to_string()
    }
}